<!DOCTYPE html>

<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>FCINEMA</title>

    <style>
        h1 {text-align: center;}
        h2 {text-align: center;}
        
        .container {
            display: flex;
            flex-wrap: wrap;
            gap: 20px;
        }
        .item {
            display: flex;
            flex-direction: column;
            align-items: center;
        }
    </style>
</head>

<body style="background-color:rgb(65, 74, 116);">
    <h1>FCINEMA</h1>
    <h2>python & php opensource web server for watch movies or videos. this software is free and dont spy on you!</h2>
    <?php

    $files = scandir('prev/');
    
    echo "<div class='container'>";
    foreach($files as $file) 
    {
        if($file !== "." && $file !== "..") 
        {
            echo "<div class='item'><img src='prev/$file', width='160', height='200'/>";
            $without_ext = pathinfo($file, PATHINFO_FILENAME);
            echo "<a href='pages/$without_ext.html'>$without_ext</a></div>";
        }
    }
    echo "</div>";
?>
</body>

</html>
